package code.ws_common_interface.ui.interlude
{
	import code.StarlingMain;
	import code.ws_common_com.core.Progress;
	import code.ws_common_interface.base.IUi;
	import code.ws_common_utils.SysUtils;
	
	import feathers.controls.ImageLoader;
	
	import feathers_exd.ctrls.UProgressBar;
	
	import flash.geom.Rectangle;
	
	import starling.display.Sprite;
	import starling.filters.BlurFilter;
	import starling.text.TextField;
	import starling.textures.Texture;
	import starling.utils.Color;
	import starling.utils.HAlign;

	/**
	 * 过场对象
	 * @author qiangchen
	 * 
	 */	
	public class InterludeLogin extends Sprite implements IUi
	{
		/** 背景图 */
		private var _bg:ImageLoader = null;
		/** 进度条 */
		public var _progress:Progress = null;
		/** 加载进度说明 */
		public var _info:TextField = null;
		
		/**
		 * 构造函数 
		 * 
		 */		
		public function InterludeLogin()
		{
			ini();
		}
		
		/**
		 * 初始化 
		 * 
		 */		
		public function ini():void
		{
			// 背景
			_bg = new ImageLoader();
			_bg.source = StarlingMain.instance.assets.getTexture( "interludeBg" );
			addChild( _bg );
			
			// 进度条
			_progress = new Progress( "progressBg", "progress", new Rectangle( 89, 10, 1, 1 ), new Rectangle( 86, 2, 1, 1 ) );
			_progress.touchable = false;
			_progress.filter = BlurFilter.createGlow( 0xffff33, 1, 2 );
			_progress.setSize( 585, 574 );
			addChild( _progress );
			_progress.x = SysUtils.stage.stageWidth - _progress.width >> 1;
			_progress.y = SysUtils.stage.stageHeight - 150;
			
			// 进度信息
			_info = new TextField( 400, 24, "Loading...", "宋体", 16 , Color.WHITE , true);
			_info.touchable = false;
			_info.filter = BlurFilter.createGlow( Color.WHITE, 1, 1 );
			_info.hAlign = HAlign.LEFT;
			addChild( _info );
			_info.x = _progress.x + 10;
			_info.y = _progress.y - _info.height - 2;
		}
		
		
		/**
		 * 释放 
		 * 
		 */		
		public function kill():void
		{
			super.dispose();
		}
		
		
		/**
		 * set progress informations 
		 * @param infos
		 * 
		 */		
		public function setProgressInfo( infos:String ):void
		{
			infos = ( infos == null || infos == "" ) ? "" : infos;
			_info.text = infos;
		}
		
		
		/**
		 * set value to show 
		 * @param value ( range: 0.0 - 1.0 );
		 * 
		 */	
		public function setProgerssVal( value:Number ):void
		{
			_progress.setValue( value );
		}
		
	}
}